css: Fix animation-direction parsing
authorBenjamin Otte <otte@redhat.com>
Mon, 7 Jul 2014 17:44:59 +0000 (19:44 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 7 Jul 2014 18:06:40 +0000 (20:06 +0200)
We were parsig "alternate-reverse" as "alternate" and then complaining
about the "-reverse" junk at the end of the value.

gtk/gtkcssenumvalue.c

index a8c807b1555d80fd42ca331b5480d8f6db407769..b131823ad026a5c55eb09f7ee585e8d7d4a212a0 100644 (file)
@@ -524,11 +524,14 @@ _gtk_css_direction_value_new (GtkCssDirection direction)
 GtkCssValue *
 _gtk_css_direction_value_try_parse (GtkCssParser *parser)
 {
-  guint i;
+  int i;
 
   g_return_val_if_fail (parser != NULL, NULL);
 
-  for (i = 0; i < G_N_ELEMENTS (direction_values); i++)
+  /* need to parse backwards here, otherwise "alternate" will also match "alternate-reverse".
+   * Our parser rocks!
+   */
+  for (i = G_N_ELEMENTS (direction_values) - 1; i >= 0; i--)
     {
       if (_gtk_css_parser_try (parser, direction_values[i].name, TRUE))
         return _gtk_css_value_ref (&direction_values[i]);